google.load("language", "1"); 

function translate${id}() {
	
    var text = document.getElementById("${sourceId}").${sourceMethod};
    google.language.detect(text, function(result) { 
      if (!result.error && result.language) { 
        google.language.translate(text, result.language, "en", 
                                  function(result) { 
          var translated = document.getElementById("${targetId}"); 
          if (result.translation) { 
            translated.${targetMethod} = result.translation; 
          } 
        }); 
      } 
    }); 
  }

